Numerical control system having a built-in personal computer

ABSTRACT

A numerical control system having a built in personal computer (PC), is made up of an interrupt generation circuit in an NC section for generating an interrupt in the NC section when a power off switch is pressed, PC termination acknowledgement means in the NC section for sending a termination request to a PC section, acknowledging a termination notification from the PC section, and requesting a DS output circuit to turn off the power of a power unit, a PC power down handling section in the PC section for forcibly terminating an application program and an operating system in the PC section after receiving the termination request sent from the PC termination acknowledgement means in the NC section, and a BIOS section for checking that the operating system is terminated and sending a termination notification to the NC section. Thus, in the numerical control system having a built-in PC, the power is turned off soundly without destroying an external storage unit such as a hard disk storage unit.

TECHNICAL FIELD

This invention relates to a personal computer built-in numerical controlsystem and in particular to breakage of an external storage unit anddata destruction prevention when power is turned off.

BACKGROUND OF THE INVENTION

With a personal computer built-in numerical control system, a workprogram is edited, etc., in a man-machine interface processing section(which will be hereinafter referred to as the MMI processing section) ofa personal computer section (which will be hereinafter referred to asthe PC section) and the work program registered in memory of a numericalcontrol system section (which will be hereinafter referred to as the NCsection) is analyzed and interpolated in the NC section, then a commandis output to a servo system of a machine tool in response to theprocessing result.

FIG. 11 shows an outline of a personal computer built-in numericalcontrol system (which will be hereinafter referred to as the PC built-innumerical control system). The PC built-in numerical control system hasan NC section 100 for executing a work program and a PC section 200 formainly performing screen display processing and setting processing ofdata, etc., and power is supplied from a power unit 5. The power unit 5converts AC power supply 200 VAC into DC and supplies 24 VDC to thenumerical control system.

The NC section 100 has a work program analysis processing section 10,memory 11, an interpolation processing section 12, axis control sections13, a machine control signal processing section 30, a ladder circuitsection 14, a digital signal input circuit (which will be hereinafterreferred to as the DS input circuit) 15, a digital signal output circuit(which will be hereinafter referred to as the DS output circuit) 16, aPC interface section 17, dual port RAM 18, flash memory 19, and backupdata write means 20.

Although only one axis control section 13 is shown in FIG. 11, it isprovided for each axis and a servo amplifier 310 of a servo motor 300 ofeach axis is connected to each axis control section 13.

Although not shown in FIG. 11, the servo motor 300 is provided with apulse generator for position detection and the servo amplifier 310 has aposition loop based on a position feedback signal from the pulsegenerator.

The PC section 200 has a BIOS (Basic I/O System) section 201, anoperating system section (which will be hereinafter referred to as theOS section) 202, an MMI processing section 210, and an NC interfacesection 203. A hard disk storage unit (which will be hereinafterreferred to as the external storage unit) 250 and an operation panel 260with a display are connected each through an interface (not shown).

The MMI processing section 210 has image display processing means 211and data setting means 212.

The operation panel 260 has a display 261 made of a CRT, an LCD, etc., adata input section 262 as a keyboard, a power on switch 263, and a poweroff switch 264.

The PC built-in numerical control system in the related art is thusconfigured. Next, the operation of the PC built-in numerical controlsystem will be discussed.

With the PC built-in numerical control system, the operator enters awork program by operating the operation panel 260 through the keyboard.

The keyed work program is input through the OS section 202 to the MMIprocessing section 210. The work program input to the MMI processingsection 210 is converted by the data setting means 212 into data codethat can be recognized by a personal computer and the data code iswritten onto the hard disk storage unit 250 through the OS section 202and is transferred to the NC interface section 203 at the same time.

The NC interface section 203 writes the work program transferred fromthe data setting means 212 into a determined address of the dual portRAM 18 in the NC section 100 and turns on a data write completion flag.

The PC interface section 17 in the NC section 100 monitors the datawrite completion flag on the dual port RAM 18. Upon detection of thedata write completion flag, the PC interface section 17 reads the workprogram written into the dual port RAM 18 and writes the work programinto a file system constructed in the memory 11.

At this time, the PC interface section 20 checks whether or not code nothandled in the numerical control system, for example, code of alowercase alphabetical character, etc., exists.

The work program written into the hard disk storage unit 250 providesbackup data if the work program registered in the memory 11 in the NCsection 100 is destroyed.

The input work program is displayed on the display 261 as follows:

First, the PC interface section 17 reads the work program registered inthe memory 11, writes the work program into a determined address of thedual port RAM 18, and turns on the data write completion flag.

The NC interface section 203 monitors the data write completion flag onthe dual port RAM 18. Upon detection of the data write completion flag,the NC interface section 203 reads the work program written into thedual port RAM 18 and transfers the work program to the image displayprocessing means 211.

The image display processing means 211 adds fixed display data of ascreen title, etc., and the like to the received work program andoutputs the resultant work program through the OS section 202 to thedisplay 261, which then displays the data of the work program, etc.

Next, an execution procedure of the work program will be discussed. Theworkprogram analysis processing section 10 reads the work program oneblock at a time from the memory 11, processes the read work program, andcalculates the end point position of each block. The interpolationprocessing section 12 interpolates the end point position anddistributes to the end point position to a move command per unit time ofeach moving axis.

The move command output by the interpolation processing section 12 isconverted into a move command per unit time considering acceleration anddeceleration according to an acceleration and deceleration patternpreviously specified by the axis control section 13, and the movecommand is output to the servo amplifier 310 as a servo move command.

Based on the servo move command, the servo amplifier 310 controls driveof the servo motor 300 attached to a machine tool (not shown).

A machine output signal of cutting oil on/off, etc., is sent from themachine control signal processing section 30 via the DS output circuit16 to a relay circuit of a machine control panel (not shown), operatinga cutting oil on/off switch, etc. A signal input from the machine sideof a dog switch, etc., is input through the DS input circuit 15 to themachine control signal processing section 30. The signals input to theDS input circuit 15 and output from the DS output circuit 16 areprocessed by the machine control signal processing section 30 throughthe ladder circuit section 14 describing machine control, and theprocessing result, etc., is sent to the interpolation processing section12.

To turn off the power of the PC built-in numerical control system in therelated art as described above, the power off switch is pressed forshutting down the input power supply of 200 VAC of the power unit 5.

When the power is turned off, the backup data write means 20 readsparameters, etc., used for controlling the servo motors, etc., from thememory 11 and writes the parameters, etc., into the flash memory 19.

The PC built-in numerical control system in the related art is thusconfigured. Thus, when the PC built-in numerical control system ispowered off unconditionally by pressing the power off switch 264, if anapplication program in the PC section 200 is accessing the hard diskstorage unit 250, particularly if data is being written onto the harddisk storage unit 250, there is a possibility that the head may come incontact with the disk of the hard disk storage unit 250, causing damageto the disk or that a file registered on the hard disk storage unit 250may be destroyed.

Although it is considered that the operator is made to surely terminatethe application program and the OS in the PC section 200 and turn offthe power, the power off operation becomes intricate and in addition,there is also a possibility that the operator may forget to terminatethe application program and the OS in the PC section 200.

When the power is abruptly turned off because of a power outage, etc.,if an application program in the PC section 200 is accessing the harddisk storage unit 250, particularly if data is being written onto thehard disk storage unit 250, there is a possibility that the hard diskstorage unit 250 itself may be destroyed. If the application program inthe PC section 200 does not normally terminate by power off handling,the power cannot be turned off.

Normally, the application program in the PC section 200 frequentlyaccesses the hard disk storage unit 250 (reads or writes) duringstarting (during initialization), thus if the power is turned off atthis time, there is a possibility that the hard disk storage unit 250may be destroyed.

While the application program in the PC section 200 is accessing thehard disk storage unit 250, particularly while data is being writtenonto the hard disk storage unit 250, if the power of the numericalcontrol system is turned off, there is a possibility that the hard diskstorage unit 250 may be destroyed.

Thus, the main circuit breaker, etc., of the machine tool cannot beturned off arbitrarily in the ladder circuit section 14.

In the PC built-in numerical control system in the related art, when thepower is turned off, parameters, etc., for controlling the servo motors,etc., are written into the flash memory 19, etc., in the NC section 100for data backup. However, the flash memory 19 has a limited capacity anddata, such as tool offset data used by the user, is not backed up.

It is therefore an object of the invention to provide a personalcomputer built-in numerical control system improved so as to turn offpower soundly without destroying an external storage unit such as a harddisk storage unit and prevent the external storage unit from beingdestroyed if the power is abruptly shut down because of a power outage,etc.

DISCLOSURE OF THE INVENTION

To the end, according to the invention, there is provided a personalcomputer built-in numerical control system, wherein a personal computeris built, having a numerical control system section and a personalcomputer section, the personal computer built-in numerical controlsystem comprising an interrupt generation circuit being placed in thenumerical control system section for generating an interrupt in thenumerical control system section when a power off switch is pressed, PCtermination acknowledgement means being placed in the numerical controlsystem section for sending a termination request to the personalcomputer section when the interrupt is generated by the interruptgeneration circuit, acknowledging a PC termination notification from thepersonal computer section, and requesting a signal output circuit toturn on a signal assigned to power off of a power unit, a PC power downhandling section being placed in the personal computer section forforcibly terminating an application program and an operating system inthe personal computer section after sensing the termination request sentfrom the PC termination acknowledgement means in the NC section, PCpower down handling start wait means being placed in the personalcomputer section for waiting for the power supply voltage holding timeor longer still after the power of the power unit is turned off at thebeginning of PC power down handling for preventing the system fromadvancing to the next process, and a BIOS section being placed in thepersonal computer section for checking that the operating system isterminated and sending a PC termination notification to the numericalcontrol system section, wherein the power unit turns off power as thesignal assigned to power off is turned on by the signal output circuit.

Thus, in the personal computer built-in numerical control systemaccording to the invention, when the power off switch is pressed, theinterrupt generation circuit generates an interrupt in the numericalcontrol system section, whereby the PC termination acknowledgement meanssends a PC termination request to the personal computer section andchecks a PC termination notification from the personal computer section.If a PC termination notification comes, the PC terminationacknowledgement means makes a request for turning on a signal assignedto power off of the power unit. When the PC power down handling sectionin the personal computer section receives the PC termination requestsent from the PC termination acknowledgement means in the numericalcontrol system section, it issues a request for forcibly terminating theapplication program and the operating system in the personal computersection. The BIOS section in the personal computer section detects theoperating system being terminated in the personal computer section andsends a PC termination notification to the PC terminationacknowledgement means in the numerical control system section. The powerunit turns off the power as the signal assigned to power off is turnedon. The PC power down handling start wait means in the personal computersection waits for the power supply voltage holding time or longer stillafter the power of the power unit is turned off at the beginning of PCpower down handling for preventing the system from advancing to the nextprocess.

The personal computer built-in numerical control system according to theinvention described above further includes digital signal outputselection means in the numerical control system section being placed inthe personal computer section for setting the state of a digital outputsignal output by a machine control signal processing section in thenumerical control system section to a specified state when power offhandling is started.

Thus, in the personal computer built-in numerical control systemaccording to the invention, when power off handling is started, thestate of a digital output signal output by the machine control signalprocessing section is set to the specified state by the digital signaloutput selection means and the machine state when the power is turnedoff can be set to a predetermined state.

According to the invention, there is provided a personal computerbuilt-in numerical control system, wherein a personal computer is built,having a numerical control system section and a personal computersection, the personal computer built-in numerical control systemcomprising power off request signal detection means being placed in thenumerical control system section for detecting a power off requestsignal from a ladder circuit section, ladder circuit correspondence PCtermination acknowledgement means being placed in the numerical controlsystem section for sending a termination request to the personalcomputer section when the power off request signal is detected by thepower off request signal detection means and acknowledging a terminationnotification from the personal computer section, power off enable signaloutput means being placed in the numerical control system section forturning on a power off enable signal for the ladder circuit section whenthe ladder circuit correspondence PC termination acknowledgement meansacknowledges the PC termination notification from the personal computersection, a PC power down handling section being placed in the personalcomputer section for forcibly terminating an application program and anoperating system in the personal computer section after sensing thetermination request sent from the ladder circuit correspondence PCtermination acknowledgement means in the numerical control systemsection, PC power down handling start wait means being placed in thepersonal computer section for waiting for the power supply voltageholding time or longer still after the power of the power unit is turnedoff at the beginning of PC power down handling for preventing the systemfrom advancing to the next porcess, and and a BIOS section being placedin the personal computer section for checking that the operating systemis terminated and sending a PC termination notification to the numericalcontrol system section, wherein the power unit turns off power as asignal assigned to power off in the ladder circuit section is turned onby a signal output circuit as the power off enable signal to the laddercircuit section is turned on by the power off enable signal outputmeans.

Thus, in the personal computer built-in numerical control systemaccording to the invention, the power off request signal detection meansin the numerical control system section detects a power off requestsignal from the ladder circuit, the ladder circuit correspondence PCtermination acknowledgement means issues a PC termination request to thepersonal computer section when the power off request signal is detectedby the power off request signal detection means and checks a PCtermination notification from the personal computer section. When theladder circuit correspondence PC termination acknowledgement meansacknowledges the PC termination notification from the personal computersection, the power off enable signal output means being placed in thenumerical control system section turns on a power off enable signal forthe ladder circuit section. The PC power down handling section in thepersonal computer section receives the PC termination request sent fromthe ladder circuit correspondence PC termination acknowledgement meansin the numerical control system section, it issues a request forforcibly terminating the application program and the operating system inthe personal computer section. The BIOS section in the personal computersection detects the operating system being terminated in the personalcomputer section and issues a PC termination notification to the PCtermination acknowledgement means in the numerical control systemsection. The power unit turns off the power as the signal assigned topower off in the ladder circuit section is turned on by the signaloutput circuit as the power off enable signal to the ladder circuitsection is turned on by the power off enable signal output means. The PCpower down handling start wait means in the personal computer sectionwaits for the power supply voltage holding time or longer still afterthe power of the power unit is turned off at the beginning of PC powerdown handling for preventing the system from advancing to the nextprocess.

In the personal computer built-in numerical control system according tothe invention described above, when a power off switch is pressed, theladder circuit section determines the state of any other signal inputfrom a machine tool and if power off conditions are not satisfied,starting of power off handling is inhibited and alarm output processingis performed, and if power off conditions are satisfied, a power offrequest signal of the ladder circuit section is turned on.

Thus, in the personal computer built-in numerical control systemaccording to the invention, when the power off switch is pressed, theladder circuit section determines the state of any other signal inputfrom the machine tool and if the power off conditions are not satisfied,starting of the power off handling is inhibited and alarm outputprocessing is performed, and if the power off conditions are satisfied,the power off request signal of the ladder circuit section is turned onand the power off handling is started.

The personal computer built-in numerical control system according to theinvention described above further includes application program startcompletion notification means being placed in the personal computersection for sending an application program start completionnotification, and PC start completion check means being placed in thenumerical control system section for checking the application programstart completion notification from the application program startcompletion notification means, if start completion is indicated, the PCstart completion check means for sending a termination processingcontinuation notification to the PC termination acknowledgement means.

Thus, in the personal computer built-in numerical control systemaccording to the invention, the application program start completionnotification means in the personal computer section sends a startcompletion notification to the numerical control system section uponcompletion of starting the application program, and the PC startcompletion check means in the numerical control system section checksthe application program start completion notification from the personalcomputer section. If start completion is indicated, the PC startcompletion check means sends a termination processing continuationnotification to the PC termination acknowledgement means.

The personal computer built-in numerical control system according to theinvention described above further includes PC termination timeout retrycheck means being placed in the numerical control system section formaking a retry over or timeout check at least either if PC terminationnotification from the personal computer section cannot be acknowledgedor if application program start completion notification cannot beacknowledged, and sending a termination notification to the PCtermination acknowledgement means or the ladder circuit correspondencePC termination acknowledgement means, and disk cache control means beingplaced in the personal computer section for invalidating a disk cache ofan external storage unit in the personal computer section after sensingtermination request sent from the PC termination acknowledgement meansin the numerical control system section, wherein the power unit outputsa power reset signal for inhibiting a controller of the external storageunit in the personal computer section from newly writing data when thepower is turned off, and. wherein the power unit has a power supplyvoltage holding function of holding power supply voltage for as long asthe time to completion of writing if an application program, etc.,starts writing onto an external storage unit at the same time as thepower of the power unit is turned off.

Thus, in the personal computer built-in numerical control systemaccording to the invention, if a response to a request sent to thepersonal computer section from the personal computer section cannot beacknowledged or if application program start completion notificationcannot be acknowledged, the PC termination timeout retry check means inthe numerical control system section makes a retry over or timeoutcheck, and sends a termination notification to the PC terminationacknowledgement means. The power unit holds the power supply voltage foras long as the time to completion of writing if the application program,etc., starts writing onto an external storage unit at the same time asthe power off handling is started. After the power reset signal isinput, data is prevented from being newly written onto the externalstorage unit.

The personal computer built-in numerical control system according to theinvention described above further includes servo amplifierinitialization means being placed in the numerical control systemsection for transmitting an emergency stop signal and a terminationcommand to a servo amplifier when power off handling is started.

Thus, in the personal computer built-in numerical control systemaccording to the invention, when the power off handling is started, theservo amplifier initialization means transmits an emergency stop signaland a termination command to the servo amplifier.

The personal computer built-in numerical control system according to theinvention described above further includes data backup means beingplaced in the numerical control system section for reading a parameterregistered in the numerical control system section or data, etc., editedby the user and transferring to the personal computer section as poweroff handling is performed, and backup data write means being placed inthe personal computer section for writing the backup data from the databackup means into a determined location of a hard disk unit.

Thus, in the personal computer built-in numerical control systemaccording to the invention, the data backup means in the numericalcontrol system section reads the parameter registered in the numericalcontrol system section or the data, etc., edited by the user andtransfers to the personal computer section as the power off handling isperformed. The backup data write means in the personal computer sectionwrites the backup data from the data backup means into the determinedlocation of a hard disk unit.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram to show a first embodiment of a personalcomputer built-in numerical control system according to the invention;

FIG. 2 is a flowchart to show a power off handling procedure of an NCsection in the first embodiment of the invention;

FIG. 3 is a schematic representation to show a power on time start PCapplication check table;

FIG. 4 is a schematic representation to show a power off time DS outputselection registration screen;

FIG. 5 is a flowchart to show a power off handling procedure of a PCsection in the first embodiment of the invention;

FIG. 6 is a timing chart to show timing of holding power supply voltagewhen input power of a power unit is shut down and timing applied whenwrite onto a hard disk storage unit occurs when the power of the powerunit is shut down;

FIG. 7 is a flowchart to show a processing procedure of registeringpower off time DS output state in the first embodiment of the invention;

FIG. 8 is a block diagram to show a second embodiment of personalcomputer built-in numerical control system according to the invention;

FIG. 9 is a ladder circuit diagram to describe input/output signals inthe second embodiment of the invention;

FIG. 10 is a flowchart to show a power off handling procedure of an NCsection in the second embodiment of the invention;

FIG. 11 is a block diagram of a personal computer built-in numericalcontrol system in a related art.

BEST MODE FOR CARRYING OUR THE INVENTION

Referring now to the accompanying drawings of FIGS. 1 to 10, embodimentsof a personal computer built-in numerical control system according tothe invention will be discussed in detail.

Parts identical with those in the related art example described aboveare denoted by the same reference numerals in the embodiments of theinvention described below and will not be discussed.

(First Embodiment)

FIG. 1 shows a first embodiment of a personal computer built-innumerical control system according to the invention.

The personal computer built-in numerical control system comprises an NCsection 100 to which an interrupt generation circuit 40 and an NC powerdown handling section 50 are added.

A power off switch 264 is connected to the interrupt generation circuit40. In other words, the power off switch 264 is connected to theinterrupt generation circuit 40. When the power off switch 264 ispressed, the interrupt generation circuit 40 generates a power offhandling interrupt in the NC section 100.

The NC power down handling section 50 has PC termination acknowledgementmeans 51, servo amplifier initialization means 52, DS output selectionmeans 53, PC start completion check means 54, PC termination timeoutretry check means 55, and data backup means 56.

The PC termination acknowledgement means 51 sends a termination requestto a PC section 200 as an interrupt is generated by the interruptgeneration circuit 40, acknowledges a PC termination notification fromthe PC section 200, and requests a DS output circuit 16 to turn on adigital signal assigned to power off of a power unit 5.

The servo amplifier initialization means 52 transmits an emergency stopsignal and a termination command to a servo amplifier 310 in power downinterrupt processing.

The DS output selection means 53 sets the state of a digital outputsignal specified during termination processing of the PC section 200 toa specified state.

The PC start completion check means 54 checks an application programstart completion notification from the PC section 200. If theapplication program start is complete, the PC start completion checkmeans 54 sends a termination processing continuation notification to thePC termination acknowledgement means 51.

If a response of the PC section 200 to a request sent to the PC section200 cannot be acknowledged or if application program start completioncannot be acknowledged, the PC termination timeout retry check means 55makes a retry over or timeout check, and sends a terminationnotification to the PC termination acknowledgement means 51.

The data backup means 56 reads parameters registered in the NC section100 or data, etc., edited by the user, etc., and transfers theparameters or data to the PC section 200 as power off handling isperformed.

A PC power down handling section 220 and PC power down handling startwait means 221 are added to the PC section 200.

After sensing a termination request from the PC terminationacknowledgement means 51 in the NC section 100, the PC power downhandling section 220 forcibly terminates an application program and anoperating system in the PC section 200.

The PC power down handling start wait means 221 prevents the system fromadvancing to the next process for as long as the time preset in aparameter, etc., when the power is turned off; the detailed operation ofthe PC power down handling start wait means 221 will be discussed later.

A BIOS section 201 checks that the operating system terminates, andsends a termination notification to the NC section 100.

In addition to usual screen display processing means 211 and datasetting means 212, DS selection setting means 213, disk cache controlmeans 214, power on time start application program (startup program)registration means 215, application program start completionnotification means 216, and backup data HD write means 217 are added toan MMI processing section 210 in the PC section 200.

The power on time start application program registration means 215registers an application program automatically started when the power isturned on.

The application program start completion notification means 216 sends astart completion notification to the NC section 100 upon completion ofthe application program start.

The backup data HD write means 217 writes backup data from the databackup means 56 into a determined location of a hard disk storage unit250.

The power unit 5 used with the PC built-in numerical control systemcontains a circuit for detecting input of the digital signal assigned topower off.

Next, power off handling in the PC built-in numerical control systemhaving the configuration as described above will be discussed withreference to FIGS. 2 to 7.

FIG. 2 is a flowchart of power off handling executed by the NC section100.

To turn of the power, if the operator presses the power off switch 264,an input signal to the interrupt generation circuit 40 goes active low,the power off switch 264 being pressed is detected (step S1).

When the input signal to the interrupt generation circuit 40 goes activelow, the interrupt generation circuit 40 causes the OS (operatingsystem) in the NC section 100 to generate an interrupt (step S2).

The OS in the NC section 100 determines the type of interrupt and causesthe NC power down handling section 50 to start a power down handlingroutine, whereby the PC termination acknowledgement means 51 starts theoperation of PC termination acknowledgement (step S3).

The correspondence between the interrupt type and processing to bestarted is previously defined in a table in the OS in the NC section100. The NC power down handling section 50 is assigned a higher prioritythan a work program analysis processing section 10, an interpolationprocessing section 12, an axis control section 13, a machine controlsignal processing section 30, a ladder circuit section 14, and a PCinterface section 17. Thus, while the NC power down handling section 50executes power down handling, the work program analysis processingsection 10, the interpolation processing section 12, the axis controlsection 13, the machine control signal processing section 30, the laddercircuit section 14, and the PC interface section 17 do not executeprocessing.

Next, the servo amplifier initialization means 52 outputs an emergencystop signal to the servo amplifier 310 (step S4).

When the servo amplifier 310 detects the emergency stop signal, if servomotor 300 is turning, immediately the servo amplifier 310 deceleratesand stops the servo motor 300. After the servo motor 300 is deceleratedand stopped, the servo amplifier 310 shuts down power supply of a powercircuit, whereby the operation of the corresponding machine tool isstopped.

Next, the servo amplifier initialization means 52 transmits atermination command to the servo amplifier 310 (step S5).

Upon reception of the termination command, the servo amplifier 310terminates the current servo loop processing being executed and waitsfor an initialization command from the NC section 100 for the next poweron of the numerical control system.

By performing the above-described processing, the power of the powercircuit of the servo amplifier 310 is shut down as hardware by theemergency stop signal and the servo loop of the servo amplifier 310 isstopped as software by the termination command, thus the servo motor 300is prevented from operating in error during the power off handling.

Next, upon reception of a processing completion notification from theservo amplifier initialization means 52, the DS output selection means53 reads data of a DS device previously registered in memory 11 on asetting screen, etc., as shown in FIG. 4 (step S6). The data registeredin the memory 11 is classified into digital signals of output on stateand digital signals of output off state.

Next, based on the read data, the DS output selection means 53 requeststhe DS output circuit 16 to turn on output (step S7). The DS outputcircuit 16 turns on signal output for the digital signal specified fromthe DS output selection means 53.

Based on the read data, the DS output selection means 53 requests the DSoutput circuit 16 to turn off output (step S8). The DS output circuit 16turns off signal output for the digital signal specified from the DSoutput selection means 53.

If the servo motor 300 drives a head or a work table moving up and down,when the power of the power circuit of the servo amplifier 310 is shutdown by the emergency stop, etc., the servo lock state (in which toprevent the table from dropping by gravitation, an electric current ismade to flow into the power circuit even in the stop state for producinga torque) is released and the head or the work table drops.

To prevent this phenomenon, an electromagnetic brake is attached to theservo motor 300 and the ladder circuit section 14 makes a determinationfor outputting an electromagnetic brake on signal through the DS outputcircuit 16, whereby the electromagnetic brake may be operated, therebypreventing the head or the work table from dropping.

In the PC built-in numerical control system according to the invention,the DS output selection means 53 outputs the digital signal on throughthe DS output circuit 16 at the same time as the servo amplifierinitialization means 52 outputs the emergency stop signal to the servoamplifier 310, thereby turning on the electromagnetic brake, thus thehead or the work table moving up and down can be prevented fromdropping.

Next, upon reception of a processing completion notification of the DSoutput selection means 53, the PC termination timeout retry check means55 initializes a timer (step S9).

The timer is counted by a timer interrupt. The timer interrupt isinterrupt service executed at regular intervals; when the power isturned on, the interrupt is started in initialization processing of theOS in the NC section 100. Whenever the timer interrupt is started atregular intervals, a timeout table is decremented. The PC terminationtimeout retry check means 55 sets a timeout value in the timeout tableand turns on a timeout check valid flag, thereby initializing the timer.

Next, the PC start completion check means 54 checks a PC applicationprogram start completion flag set in dual port RAM 18 (step S10).

This flag is checked as follows:

An application program started when the power is turned on is previouslyregistered in a power on time start PC application program check tableplaced in the memory 11 starting at bit 0 as shown in FIG. 3 on asetting screen, etc.

To register the application program in the table, the power on timestart application program registration means 215 in the PC section 200converts the data set on the setting screen, etc., into bit data asshown in FIG. 3 and writes the bit data into the power on time start PCapplication program check table in the memory 11 through an NC interfacesection 203, the dual port RAM 18, and the PC interface section 17.

A start completion PC application program check table having similarcontents is also defined in the dual port RAM 18 and each applicationprogram in the PC section 200 started when the power is turned on turnson a start completion flag on a predetermined bit.

The start completion flag is turned on by the application program startcompletion notification means 216. The application program startcompletion notification means 216 is previously added to the applicationprogram started when the power is turned on.

The PC start completion check means 54 compares the power on time startPC application program check table in the memory 11 with the startcompletion PC application program check table in the dual port RAM 18.If they do not match (NO at step S10), the PC start completion checkmeans 54 judges that some application program in the PC section 200 isbeing started, and sends a timeout check notification to the PCtermination timeout retry check means 55.

Thus, the PC termination timeout retry check means 55 receives thenotification from the PC start completion check means 54 and checks thetimeout table (step S11).

As a result of the checking, if the timeout check valid flag is on andthe timeout table is greater than 0, namely, if the timeout is notreached (NO at step S11), the PC termination timeout retry check means55 sends a notification to the PC start completion check means 54 forinstructing the PC start completion check means 54 to again execute stepS10. If the timeout check valid flag is on and the timeout table becomesequal to or less than 0 (YES at step S11), the PC termination timeoutretry check means 55 judges that timeout occurs, and goes to step S24for displaying an alarm message.

If the power on time start PC application program check table in thememory 11 matches the start completion PC application program checktable in the dual port RAM 18 (YES at step S10), the PC start completioncheck means 54 judges that starting of all application programs in thePC section 200 that must be started when the power is turned on iscomplete, and sends an application program start completion notificationto the data backup means 56.

Next, the data backup means 56 reads parameters, etc., for controllingthe servo motors, etc., registered in the memory 11 and data of tooloffset, etc., used by the user, sets the parameters, etc., and the datain the dual port RAM 18 through the PC interface section 17, and sets abackup data set completion flag placed in the dual port RAM 18. Thebackup data HD write means 217 in the PC section 200 monitors the backupdata set completion flag through the NC interface section 203. If theflag is turned on, the backup data HD write means 217 reads backup dataset in the dual port RAM 18 and writes the read backup data into apredetermined directory (folder) on the hard disk storage unit 250 (step23). Upon completion of writing the backup data onto the hard diskstorage unit 250, the backup data HD write means 217 resets the backupdata set completion flag. The data backup means 56 detects the flagbeing reset and sends a completion notification to the PC terminationtimeout retry check means 55.

Thus, the PC termination timeout retry check means 55 turns off thetimeout check valid flag and resets the timer (step S12), then sets avalue in a retry counter (step S13). The counter value is preset in aparameter on a screen, etc., and is registered in the memory 11.

Next, the PC termination acknowledgement means 51 issues a PCtermination request to the PC section 200 (step S14). The PC section 200has an interrupt circuit (not shown) equivalent to the interruptgeneration circuit 40 in the NC section 100, and the PC terminationrequest is issued to the interrupt circuit.

Referring also to FIG. 5, a power off handling flow in the PC section200 is also covered in the description to follow.

As the PC termination request is received at the interrupt circuit, thePC section 200 starts the PC power down handling section 220 (step S50).

Next, the PC power down handling start wait means 221 operates andprevents the system from advancing to the next process for as long asthe time preset in a parameter, etc., (step S56). Specifically, simpleloop processing is executed for as long as the preset time in the PCpower down handling start wait means 221. Since processing of the PCpower down handling start wait means 221 is executed in the interruptservice, any other application program in the PC section 200 cannot beexecuted. Therefore, while the PC power down handling start wait means221 operates, processing of accessing the hard disk storage unit 250 iseliminated. Since the power unit 5 holds power supply voltage asdescribed later after an off signal is entered, if the loop time is setto the time longer than the hold time, the PC power down handling isterminated during execution of the loop processing in the interrupt.That is, even if the power is abruptly turned off because of a poweroutage, etc., the process advances from the NC power down handlingsection 50 to the PC power down handling section 220 and during forcibletermination of the application and the OS described later, namely, whenthe hard disk storage unit 250 is frequently accessed, etc., the poweris not turned off.

When the PC power down handling section 220 is started, it turns on a PCtermination request response flag in the dual port RAM 18 (step S51).

The PC termination acknowledgement means 51 in the NC section 100 checksthe PC termination request response flag in the dual port RAM 18. If thePC termination request response flag is off (NO at step S15), the PCtermination acknowledgement means 51 sends a retry check notification tothe PC termination timeout retry check means 55.

Thus, the PC termination timeout retry check means 55 checks the retrycounter. If the retry counter is greater than 0 (NO at step S16), the PCtermination timeout retry check means 55 instructs the PC terminationacknowledgement means 51 to again execute step S14, and decrements theretry counter.

In contrast, if the retry counter becomes 0 (YES at step S16), the PCtermination timeout retry check means 55 judges retry over and instructsthe PC termination acknowledgement means 51 to go to step S22.

If the PC termination request response flag is turned on (YES at stepS15), the PC termination timeout retry check means 55 initializes thetimer (step S17).

In the PC section 200, after the PC termination request response flag isturned on, the PC power down handling section 220 issues a forcibletermination request to the OS section 202 (step S52).

For example, if the OS is WINDOW 95 (registered trademark of MicrosoftCorporation), a forcible termination function is provided and thus iscalled.

As the forcible termination request is issued to the OS section 202, theOS section 202 forcibly terminates the current application program beingstarted according to a procedure proper to the operating system (stepS53). After acknowledging the termination of the application program,the OS section 202 terminates the operating system (OS) itself (stepS54).

When the operating system is terminated and the PC section 200 enters astate in which the power may be turned off, the PC section 200 issues aPC termination notification to the NC section 100 (step S55).

This PC termination notification is issued as follows: Just before theOS section 202 is terminated, it notifies the BIOS section 201 that theoperating system termination processing is complete. Upon reception ofthe termination processing completion notification from the OS section202, the BIOS section 201 turns on a PC termination completion flag inthe dual port RAM 18. WINDOW 95 provides a function called “AdvancedPower Management (hereinafter abbreviated as APM) Function” and whenWINDOW 95 is terminated, “AMP Function” is called.

When “AMP Function” is called, a function corresponding to the AMPFunction provided for the BIOS section 201 is called. A process ofturning on the PC termination completion flag in the dual port RAM 18 isentered in the function corresponding to the AMP Function provided forthe BIOS section 201, whereby the PC termination completion flag in thedual port RAM 18 can be turned on when WINDOW 95 is terminated.

Here, a return is made to the description of the power off handling inthe NC section 100. The PC termination acknowledgement means 51 in theNC section 100 checks the PC termination completion flag in the dualport RAM 18. If the PC termination completion flag is turned on (YES atstep S18), control goes to step S22. In contrast, if the PC terminationcompletion flag is off (NO at step S18), the PC terminationacknowledgement means 51 issues a timeout check request to the PCtermination timeout retry check means 55, and timeout is monitored inthe same manner as at step S11 (step S19).

If the timeout is not reached (NO at step S19), the PC terminationacknowledgement means 51 is instructed to again execute step S18. Incontrast, if the timeout is reached (YES at step S19), control goes tostep S22. At step S22, whether or not the machine stops, namely, whetheror not a spindle motor, etc., stops is checked. As a simple checkmethod, whether or not an emergency stop status signal is turned on ischecked. Alternatively, whether or not the number of revolutions of thespindle motor reaches 0 is checked.

At step S20, the PC termination acknowledgement means 51 requests the DSoutput circuit 16 to turn on the digital signal assigned to power off ofthe power unit 5. The DS output circuit 16 outputs on the digital signalrequested to be turned on by the PC termination acknowledgement means51.

As the digital signal assigned to power off of the power unit 5 isturned on, the power unit 5 shuts down (turns off) the input powersupply and feeds a power reset signal into the PC section 200 and the PCtermination acknowledgement means 51 executes simple loop processing.Finally, the output voltage of the power unit 5 reaches 0 in a giventime, thus the PC termination acknowledgement means 51 terminates theprocessing while executing the loop processing (step S21).

The power reset signal is connected to an HD controller of the hard diskstorage unit 250. Even if the power off handling terminates at thetimeout or exceeding the number of retries described above and theapplication program does not terminate and continues to executeprocessing, when the power reset signal is input to the HD controller,the hard disk storage unit 250 does not write new data.

However, there is a possibility that data in disk cache of the HDcontroller may be written continuously onto the hard disk storage unit250 still after the power reset signal is accepted. If voltage dropswhile the data is being written, the head of the hard disk storage unit250 comes in contact with the disk storage medium, destroying thehardware of the hard disk storage unit 250. To avoid this situation, itis necessary to previously invalidate the disk cache. To do this,setting of the disk cache of the HD controller can be validated by thedisk cache control means 214 in the PC section 200.

Normally, if the disk cache is invalidated, the apparent operation speedof the application program may be decreased; in the numerical controlsystem, most application programs usually used in the PC section 200concern screen display of a parameter setting screen, etc. For thescreen display, the data read from and written onto the hard diskstorage unit 250 often varies in screen units, thus if the disk cache isvalidated, the disk cache hit probability is low. Therefore, if the diskcache is invalidated, the apparent operation speed of the applicationprogram is scarcely decreased.

If the disk cache is invalidated, new data is not written onto the harddisk storage unit 250 after the power reset signal is input from thepower unit 5.

However, if the application program or the OS section 202 executesprocessing, because of the timing at which the application programstarts writing onto the hard disk storage unit 250 at the same time, itis necessary to hold the power supply voltage longer than the time tocompletion of writing onto the hard disk storage unit 250 by theapplication program. That is, the power supply voltage needs to be heldfor as long as the write guarantee time.

To hold the power supply voltage for as long as the write guaranteetime, a capacitor 6 is built in the power unit 5. The power supplyvoltage holding time is determined by the capacity of the capacitor 6.

Next, a DS output specification method when the power is turned off willbe discussed using a power off time DS output selection registrationscreen example shown in FIG. 4 and a flowchart of FIG. 7.

First, a power off time DS output selection registration screen as shownin FIG. 4 provided as an application program in the PC section 200 isselected (step S40). FIG. 4 shows set items of “Y001”, “Y002,” . . . asoutput devices. Each output device set item includes a field for settinga state applied when the power is turned off and a comment field fordescribing the use purpose, etc., of the corresponding output device.

Next, 1, 0, or −1 is set in the field for setting the output devicestate applied when the power is turned off (step S41). The value 1 meansthat the signal of the output device is turned on when the power isturned off, the value 0 means that the signal of the output device isturned off when the power is turned off, and the value −1 means that thesignal of the output device is held in the current state.

The setup data is compiled to information of the output devices whosesignal is turned on when the power is turned off by the DS selectionsetting means 213 and the information is registered in the memory 11through the NC interface section 203, the dual port RAM 18, and the PCinterface section 17 (step S42)

The DS selection setting means 213 compiles information of the outputdevices whose signal is turned off when the power is turned off andregisters the information in the memory 11 through the NC interfacesection 203, the dual port RAM 18, and the PC interface section 17 (stepS43).

As described above, in the embodiment, when the power is turned off, theapplication program and the operating system in the PC section 200 areterminated before the power is actually turned off. Thus, this preventsthe application program or the operating system in the PC section 200from reading or writing data from or onto the hard disk storage unit 250at the instant at which the power is turned off; the hard disk isprevented from being destroyed or a file registered on the hard disk isprevented from being destroyed.

In the power off handling, if a response of the PC section 200 to thepower off request issued from the NC section 100 to the PC section 200cannot be acknowledged, or if the application program start completioncannot be acknowledged, retry over or timeout handling is performed andthe power off handling is continued. Thus, if an abnormal conditionoccurs in the PC section 200 and data write onto the hard disk storageunit 250 occurs at the same time as the power is turned off, the powerunit 5 holds the power supply voltage for as long as the time tocompletion of the write. Thus, if an abnormal condition occurs in the PCsection 200, the hard disk storage unit 250 is not destroyed and thepower can always be turned off reliably.

Since a wait is made for power off handling to completion of starting anapplication program in the PC section 200, when the power is turned off,the application program in the PC section 200 is prevented from readingor writing data from or onto the hard disk storage unit 250; the harddisk storage unit 250 is prevented from being destroyed or a fileregistered on the hard disk is prevented frombeing destroyed, and thepower can be turned off soundly.

(Second Embodiment)

FIG. 8 shows a second embodiment of personal computer built-in numericalcontrol system according to the invention. Parts identical with orsimilar to those previously described with reference to FIG. 1 aredenoted by the same reference numerals in FIG. 8 and will not bediscussed again.

In the second embodiment, a machine control signal processing section 30in an NC section 100 is provided with ladder circuit correspondence PCtermination acknowledgment means 32, power off request signal detectionmeans 33, power off enable signal output means 34, servo amplifierinitialization means 52, PC start completion check means 54, and PCtermination timeout retry check means 55 in addition to usual machinecontrol signal processing means 31.

As the power off request signal detection means 33 detects a power offrequest signal issued from a ladder circuit section 14, the laddercircuit correspondence PC termination acknowledgment means 32 sends atermination request to a PC power down handling section 220 in a PCsection 200 and acknowledges a termination notification from the PCsection 200.

The power off enable signal output means 34 outputs a power off enablesignal to the ladder circuit section 14 after sensing the terminationrequest from the ladder circuit correspondence PC terminationacknowledgment means 32.

The servo amplifier initialization means 52, the PC start completioncheck means 54, and the PC termination timeout retry check means 55 maybe substantially the same as those in the first embodiment.

A power off switch 264 is connected to a DS input circuit 15 in the NCsection 100. When the power off switch 264 is pressed, a power off inputsignal to the DS input circuit 15 makes a transition to an on state. Themachine control signal processing means 31 detects the signal input tothe DS input circuit 15, then converts the signal into a signalcorresponding to the ladder circuit section 14 and notifies the laddercircuit section 14 that the power off input signal is input.

As shown in FIG. 9, the ladder circuits of the ladder circuit section 14include device “Y305” defining a power off request signal and device“X310” defining a power off enable signal. As the ladder circuit 14turns on the device “Y305,” the power off request signal detection means33 detects the power off request signal from the ladder circuit section14.

Upon reception of a notification from the ladder circuit correspondencePC termination acknowledgment means 32, the device “X310” is turned onand the power off enable signal output means 34 turns on.

A power unit 5, like that in the first embodiment, contains a circuitfor detecting input of a digital signal assigned to power off and acapacitor 6 to hold the power supply voltage for as long as the writeguarantee time is built in the power unit 5.

The PC section 200 has a configuration similar to that in the firstembodiment; the PC power down handling section 220 is given atermination request from the ladder circuit correspondence PCtermination acknowledgment means 32 in the machine control signalprocessing section 30, then forcibly terminates each application programand the operating system in the PC section 200.

Next, power off handling in the PC built-in numerical control systemhaving the configuration as described above will be discussed withreference to a ladder circuit diagram of FIG. 9 and a flowchart of FIG.10.

To turn of the power, if the operator presses the power off switch 264,a power off input signal to the DS input circuit 15 makes a transitionto an on state (step S71). The machine control signal processing means31 detects the signal input to the DS input circuit 15, then convertsthe input signal into a signal corresponding to the ladder circuitsection 14and notifies the ladder circuit section 14 that the power offinput signal is input.

When the ladder circuit section 14 receives the notification indicatingthat the power off input signal goes on, it determines the state of anyother signal input from the machine tool and checks whether or not thepower may be turned off (step S72). If the power off conditions are notsatisfied (NO at step S72), the ladder circuit section 14 goes to stepS90.

At step S90, the ladder circuit section 14 requests the machine controlsignal processing section 30 to turn on an alarm lamp and at the sametime, makes a request for displaying an alarm message and cause.

Upon detection of the request for turning on the alarm lamp from theladder circuit section 14, the machine control signal processing means31 in the machine control signal processing section 30 turns on therelay connected to the alarm lamp through a DS output circuit 16 forturning on the alarm lamp. Responding to the message display request,the machine control signal processing means 31 displays an alarm messageand cause on a display 261 through a PC interface section 17, dual portRAM 18, an NC interface section 203, and screen display processing means211.

If the power off conditions are satisfied (YES at step S72), the laddercircuit section 14 turns on an emergency stop request signal for themachine control signal processing section 30. When the machine controlsignal processing means 31 in the machine control signal processingsection 30 detects the emergency stop request signal, it outputs anemergency stop signal to a servo amplifier 310 (step S73). The operationof the servo amplifier 310 responsive to the emergency stop signal isthe same as the operation previously described at step S4 in the firstembodiment.

Next, the ladder circuit section 14 turns on a power off request signalfor the machine control signal processing section 30 (step S74).Specifically, in the ladder circuit diagram of FIG. 9, the device “Y305”defining the power off request signal is turned on.

When the power off request signal detection means 33 in the machinecontrol signal processing section 30 detects the power off requestsignal from the ladder circuit section 14, it notifies the servoamplifier initialization means 52 and the ladder circuit correspondencePC termination acknowledgment means 32 that the power off request signalhas been detected.

Upon reception of the notification indicating detection of the power offrequest signal, the servo amplifier initialization means 52 transmits atermination command to the servo amplifier 310 through an interpolationprocessing section 12 and an axis control section 13 (step S75).

Upon reception of the termination command, the servo amplifier 310terminates the current servo loop processing being executed and waitsfor an initialization command from the PC built-in numerical controlsystem for the next power on of the PC built-in numerical controlsystem.

Next, the PC termination timeout retry check means 55 receives aprocessing completion notification of the servo amplifier initializationmeans 52 and initializes a timer (step S76). The initializationprocedure of the timer is the same as that previously described at stepS9 in the first embodiment.

Next, the PC start completion check means 54 checks a PC applicationprogram start completion flag set in the dual port RAM 18 (step S77).The procedure of checking the PC application program start completionflag is the same as that previously described at step S10 in the firstembodiment.

If a power on time start PC application program check table in thememory 11 does not match a start completion PC application program checktable in the dual port RAM 18 (NO at step S77), it is judged that someapplication program in the PC section 200 is being started, and atimeout check notification is sent to the PC termination timeout retrycheck means 55.

Thus, the PC termination timeout retry check means 55 receives thenotification from the PC start completion check means 54 and checks atimeout table (step S78).

As a result of the checking, if a timeout check valid flag is on and thetimeout table is greater than 0, namely, if the timeout is not reached(NO at step S78), the PC termination timeout retry check means 55 sendsa notification to the PC start completion check means 54 for instructingthe PC start completion check means 54 to again execute step S77. If thetimeout check valid flag is on and the timeout table becomes equal to orless than 0 (YES at step S78), the PC termination timeout retry checkmeans 55 judges that timeout occurs, and goes to step S91 for displayingan alarm message.

If the power on time start PC application program check table in thememory 11 matches the start completion PC application program checktable in the dual port RAM 18 (YES at step S77), the PC start completioncheck means 54 judges that starting of all application programs in thePC section 200 that must be started when the power is turned on iscomplete, and sends an application program start completion notificationto the PC termination timeout retry check means 55.

Thus, the PC termination timeout retry check means 55 turns off thetimeout check valid flag and resets the timer (step S79), then sets avalue in a retry counter (step S80).

Next, based on notifications from the PC termination timeout retry checkmeans 55 and the power off request signal detection means 33, the laddercircuit correspondence PC, termination acknowledgment means 32 issues aPC termination request to the PC section 200 (step S81).

Also in the second embodiment, the PC section 200 has an interruptcircuit (not shown) equivalent to an interrupt generation circuit in theNC section 100, and the PC termination request is issued to theinterrupt circuit.

The ladder circuit correspondence PC termination acknowledgment means 32in the NC section 100 checks a PC termination request response flag inthe dual port RAM 18. If the PC termination request response flag is off(NO at step S82), the ladder circuit correspondence PC terminationacknowledgment means 32 sends a retry check notification to the PCtermination timeout retry check means 55.

Thus, the PC termination timeout retry check means 55 checks the retrycounter. If the retry counter is greater than 0 (NO at step S83), the PCtermination timeout retry check means 55 instructs the ladder circuitcorrespondence PC termination acknowledgment means 32 to again executestep S81, and decrements the retry counter.

In contrast, if the retry counter becomes 0 (YES at step S83), the PCtermination timeout retry check means 55 judges retry over and instructsthe ladder circuit correspondence PC termination acknowledgment means 32to go to step S87.

If the PC termination request response flag is turned on (YES at stepS82), the PC termination timeout retry check means 55 initializes thetimer (step S84).

After this, the ladder circuit correspondence PC terminationacknowledgment means 32 checks a PC termination completion flag in thedual port RAM 18. If the PC termination completion flag is turned on(YES at step S85), control goes to step S87.

In contrast, if the PC termination completion flag is off (NO at stepS85), the ladder circuit correspondence PC termination acknowledgmentmeans 32 issues a timeout check request to the PC termination timeoutretry check means 55, and timeout is monitored in the same manner as atstep S78 (step S86).

If the timeout is not reached (NO at step S86), the ladder circuitcorrespondence PC termination acknowledgment means 32 is instructed toagain execute step S85. In contrast, if the timeout is reached (YES atstep S86), control goes to step S87.

At step S87, the ladder circuit correspondence PC terminationacknowledgment means 32 sends a PC termination completion notificationto the power off enable signal output means 34. Upon reception of thenotification from the ladder circuit correspondence PC terminationacknowledgment means 32, the power off enable signal output means 34turns on a power off enable signal. Specifically, in the ladder circuitdiagram of FIG. 9, the device “Y310” defining the power off enablesignal is turned on.

Here, the ladder circuit correspondence PC termination acknowledgmentmeans 32 and the PC start completion check means 54 may repeat checking.However, since the means 32 and 53 exist in the machine control signalprocessing section 30 executed periodically, in execution of processing,the checking does not make a loop in the means and the machine controlsignal processing section 30 is designed so that it is always executedperiodically.

Next, the ladder circuit section 14 checks the power off enable signal.If the power off enable signal goes on, the ladder circuit section 14outputs a signal to the DS assigned to power off of the power unit 5(step S88).

As the DS assigned to power off of the power unit 5 is turned on, thepower unit 5 shuts down (turns off) the input power supply and feeds apower reset signal into the PC section 200 (step S89). The power resetoperation for an HD controller and the state of a disk cache are thesame as the contents previously described at step S21 in the firstembodiment.

As described above, in the second embodiment, the ladder circuit section14 can check that the application program and the operating system inthe PC section 200 are terminated. Thus, the ladder circuit section 14determines the power off conditions, so that the power unit 5 or a maincircuit breaker of the PC built-in numerical control system can beturned off and further it is also made possible to automatically turnoff the power.

At the instant at which the power is turned off, the application programor the operating system in the PC section 200 is prevented from readingor writing data from or onto the hard disk storage unit 250; the harddisk storage unit 250 is prevented from being destroyed or a fileregistered on the hard disk storage unit 250 is prevented from beingdestroyed.

Since a digital IO signal circuit of power off is contained in the powerunit, the power of the power unit can be turned off using the samesignal line for normal power off and power off based on an instructionof the ladder circuit section, wiring being saved.

The data backup means 56 in the NC section 100 and the backup data HDwrite means 217 and the PC power down handling start wait means 221 inthe PC section 200 previously described in the first embodiment are notcovered in the description of the second embodiment, but the data backupmeans 56 in the NC section 100 and the backup data HD write means 217and the PC power down handling start wait means 221 in the PC section200 may also be provided in the second embodiment, needless to say.

As seen from the description made so far, according to the PC built-innumerical control system according to the invention, when the power isturned off, the application program and the operating system in the PCsection are terminated before the power is actually turned off. Thus,this prevents the application program or the operating system in the PCsection from reading or writing data from or onto an external storageunit such as a hard disk storage unit at the instant at which the poweris turned off; the external storage unit is prevented from beingdestroyed or a file registered on the external storage unit is preventedfrom being destroyed. Since the power off handling in the NC section isexecuted as one closed process independent of each process in the NCsection, the power can be reliably turned off without being affected bythe execution state of each process in the NC section.

According to the personal computer built-in numerical control system,since personal computer processing is terminated automatically, theoperator is prevented from forgetting to terminate the applicationprogram and the OS in the PC section when turning off the power. Since await is made for the power supply voltage holding time or longer stillafter the power of the power unit is turned off at the top of the PCpower down handling section (interrupt service) in the PC section, ifthe power unit turns off power because of a power outage, etc. thefollowing can be prevented. Abruptly the current application program orthe operating system in the PC section is forcibly terminated and thepower is turned off while the external storage unit is frequentlyaccessed, destroying the external storage unit. That is, if the powerunit turns off power because of a power outage, etc. the PC section isinterrupted and the application program, etc. in the PC section stopsexecution (in turn, the operation of frequently accessing the externalstorage unit is stopped). Since the PC power down handling start waitmeans maintains the stop state, the following can be prevented: The holdvoltage of the power unit runs out in the stop period time and theoperation of the PC section is terminated, destroying the externalstorage unit. Since a wait is made for the power supply voltage holdingtime or longer still after the power of the power unit is turned off atthe top of the PC power down handling section for preventing the systemfrom advancing to the next process, both the circuit and handling(processing) can be made common to power off with the power off switchand power off because of a power outage, etc., simplifying theconfiguration.

Since a wait is made for the power supply voltage holding time or longerstill after the power of the power unit is turned off at the top of thePC power down handling section (interrupt service) in the PC section forpreventing the system from advancing to the next process, if the powerunit turns off power because of a power outage, etc., the following canbe prevented: Abruptly the current application program or the operatingsystem in the PC section is forcibly terminated and the power is turnedoff while the external storage unit is frequently accessed, destroyingthe external storage unit. That is, it the power unit turns off powerbecause of a power outage, etc., the PC section is interrupted and theapplication program, etc., in the PC section stops execution (in turn,the operation of frequently accessing the external storage unit isstopped). Since the PC power down handling start wait means maintainsthe stop state, the following can be prevented: The hold voltage of thepower unit runs out in the stop period time and the operation for the PCsection is terminated, destroying the external storage unit. Since await is made for the power supply voltage holding time or longer stillafter the power of the power unit is turned off at the top of the PCpower down handling section for preventing the system from advancing tothe next process, both the circuit and handling (processing) can be madecommon to power off with the power off switch and power off because of apower outage, etc. simplifying the configuration.

According to the following personal computer built-in numerical controlsystem according to the invention, when power off handling is started,the state of a digital output signal output by a machine control signalprocessing section is set by digital signal output selection means to aspecified state and the machine state when the power is turned off canbe set to a predetermined state. Thus, for example, if the servo lockstate of a servo motor is released by turning off the power of the servomotor for controlling a head or a work table moving up and down, adigital signal for an electromagnetic brake of the servo motor is turnedon for actuating the electromagnetic brake, whereby the head or the worktable can be prevented from dropping.

According to the following personal computer built-in numerical controlsystem according to the invention, a ladder circuit can check that anapplication program and an operating system in a PC section areterminated. Thus, a power unit or a main circuit breaker can be turnedoff based on power off condition determination of the ladder circuit,and the application program or the operating system in the PC section isprevented from reading or writing data from or onto an external storageunit such as a hard disk storage unit at the instant at which the poweris turned off; the external storage unit is prevented from beingdestroyed or a file registered on the external storage unit is preventedfrom being destroyed. For a machine tool having a function whereby ifworking of a predetermined number of workpieces is complete, a laddercircuit section judges it and turns off the power of the tool machine(automatic power off function), the automatic power off function can beprovided without inviting destruction of an external storage unit.

According to the following personal computer built-in numerical controlsystem according to the invention, as a power off switch is pressed, aladder circuit section determines the state of any other signal inputfrom a machine tool. If the power off conditions are not satisfied,staring of power off handling is inhibited and alarm output processingis performed. If the power off conditions are satisfied, a power offrequest signal of the ladder circuit section is turned on and power offhandling is started. Thus, if there is a harm in turning off the powerof the machine tool, the power can be prevented from being turned offand a failure can be prevented from occurring in the machine tool.

According to the following personal computer built-in numerical controlsystem according to the invention, when starting of an applicationprogram is complete, application program start completion notificationmeans in a PC section sends a start completion notification to an NCsection, and PC start completion check means in the NC section checksthe application program start completion notification from the PCsection. If start completion is indicated, the PC start completion checkmeans sends a notification indicating termination processingcontinuation to termination acknowledgement means. Thus, a wait is madefor power off handling until completion of starting the applicationprogram in the PC section. Although an external storage unit such as ahard disk storage unit is frequently accessed (data read or write) whilethe application program in the PC section is being started (duringinitialization), the application program in the PC section is preventedfrom reading or writing data from or onto an external storage unit atthe instant at which the power is turned off; the external storage unitis prevented from being destroyed or a file registered-on the externalstorage unit is prevented from being destroyed, and the power can beturned off reliably.

According to the following personal computer built-in numerical controlsystem according to the invention, if PC termination retry timeout checkmeans in an NC section cannot acknowledge a response of a PC section toa request issued to the PC section or if an application program startcompletion notification cannot be acknowledged, retry over or timeoutchecking is performed, thus the processing termination of the personalcomputer section can be acknowledged more reliably. After terminationrequest sent from the PC termination acknowledgement means in thenumerical control system section is sensed, a disk cache of an externalstorage unit in the personal computer section is invalidated and a powerunit outputs a power reset signal for inhibiting a controller of theexternal storage unit in the personal computer section from newlywriting data, thus the controller of the external storage unit in thepersonal computer section does not newly write data and at this time,the disk cache of the controller of the external storage unit isinvalidated. A termination notification is sent to PC terminationacknowledgement means. If an application program, etc., starts writingonto an external storage unit at the same time as power off is started,a power unit holds the power supply voltage for as long as the time tocompletion of the writing. Thus, if an abnormal condition occurs in thePC section and writing onto an external storage unit such as a hard diskstorage unit occurs at the same time as the power is turned off, thepower supply voltage is held for as long as the time to completion ofthe writing; if an abnormal condition occurs in the PC section, theexternal storage unit is not destroyed and the power can always beturned off reliably. If the power is abruptly turned off because of apower outage, if an application program or an operating system in the PCsection starts writing onto an external storage unit at the same time asthe power is turned off, the power unit holds the power supply voltagefor as long as the time to completion of the writing, so that theexternal storage unit is not destroyed. If an expensive unit such as aUPS (uninterruptible power supply) is not provided, the external storageunit can be prevented from being destroyed.

According to the following personal computer built-in numerical controlsystem according to the invention, as power off handling is started,servo amplifier initialization means transmits an emergency stop signaland a termination command to a servo amplifier, thus the correspondingservo motor is stopped and the servo amplifier waits for aninitialization command for the next power on of the numerical controlsystem.

According to the following personal computer built-in numerical controlsystem according to the invention, parameters, etc., for controllingservo motors, etc., are backed up on an external storage unit, so thatnonvolatile memory such as flash memory used for data backup by aconventional numerical control system need not be provided.

Although the flash memory in the conventional numerical control systemis limited in data size and is hard to back up all data, the backed-upparameters and data size are not limited because the data is backed upon the external storage unit.

INDUSTRIAL APPLICABILITY

As described above, the invention is appropriate for use with a personalcomputer built-in numerical control system.

What is claimed is:
 1. A numerical control system having a numericalcontrol (NC) system section and a personal computer (PC) section, saidnumerical control system comprising: an interrupt generation circuitprovided in the numerical control system section for generating aninterrupt in the NC system section when a power off switch is pressed;PC termination acknowledgement means provided in the numerical controlsystem section for sending a termination request to the personalcomputer section when the interrupt is generated by said interruptgeneration circuit, acknowledging a PC termination notification from thepersonal computer section, and requesting a signal output circuit toturn on a signal previously assigned to power off a power unit; a PCpower down handling section provided in the personal computer sectionfor forcibly terminating an application program and an operating systemin the personal computer section after receiving the termination requestsent from said PC termination acknowledgement means in the numericalcontrol system section; PC power down handling start wait means providedin the personal computer section for waiting for at least a power supplyvoltage holding time after the power of the power unit is turned off atthe beginning of PC power down handling for preventing said operatingsystem from advancing to the next process, and a BIOS section providedin the personal computer section for checking that the operating systemis terminated and sending the PC termination notification to thenumerical control system section, wherein the power unit turns off poweras the signal assigned to power off is turned on by the signal outputcircuit.
 2. The numerical control system as claimed in claim 1, furthercomprising digital signal output selection means provided in thenumerical control system section for setting a state of a digital outputsignal output by a machine control signal processing section in thenumerical control system section, to a specified state when power offhandling is started.
 3. A numerical control system having a numericalcontrol system section and a personal computer section, said numericalcontrol system comprising: power off request signal detection meansprovided in the numerical control system section for detecting a poweroff request signal from a ladder circuit section; ladder circuitcorrespondence PC termination acknowledgement means provided in thenumerical control system section for sending a termination request tothe personal computer section when the power off request signal isdetected by said power off request signal detection means andacknowledging a termination notification from the personal computersection; power off enable signal output means provided in the numericalcontrol system section for turning on a power off enable signal of theladder circuit section when said ladder circuit correspondence PCtermination acknowledgement means acknowledges the PC terminationnotification from the personal computer section; a PC power downhandling section provided in the personal computer section for forciblyterminating an application program and an operating system in thepersonal computer section after receiving the termination request sentfrom said ladder circuit correspondence PC termination acknowledgementmeans in the numerical control system section; and PC power downhandling start wait means provided in the personal computer section forwaiting for at least a power supply voltage holding time after the powerof the power unit is turned off at the beginning of PC power downhandling, for preventing said operating system from advancing to thenext process; a BIOS section provided in the personal computer sectionfor checking that the operating system is terminated and sending a PCtermination notification to the numerical control system section,wherein the power unit turns off power when a signal assigned to poweroff, in the ladder circuit section, is turned on by a signal outputcircuit, and the power off enable signal of the ladder circuit sectionis turned on by said power off enable signal output means.
 4. Thenumerical control system as claimed in claim 3, wherein when a power offswitch is pressed, the ladder circuit section determines a state of anyother signal input from a machine tool, wherein if power off conditionsare not satisfied, starting of power off handling is inhibited and alarmoutput processing is performed, and wherein if power off conditions aresatisfied, a power off request signal of the ladder circuit section isturned on.
 5. The numerical control system as claimed in any one ofclaims 1 to 4, further comprising: application program start completionnotification means provided in the personal computer section for sendingan application program start completion notification; and PC startcompletion check means provided in the numerical control system sectionfor checking the application program start completion notificationreceived from said application program start completion notificationmeans, and if start completion is indicated, said PC start completioncheck means sends a termination processing continuation notification tosaid PC termination acknowledgement means or said ladder circuitcorrespondence PC termination acknowledgement means.
 6. The numericalcontrol system as claimed in any one of claims 1 to 4, furthercomprising: PC termination timeout retry check means provided in thenumerical control system section for initiating a retry or a timeoutcheck, at least if PC termination notification from the personalcomputer section cannot be acknowledged or if an application programstart completion notification cannot be acknowledged, and sending atermination notification to said PC termination acknowledgement means orsaid ladder circuit correspondence PC termination acknowledgement means;and disk cache control means provided in the personal computer sectionfor invalidating a disk cache of an external storage unit in thepersonal computer section after receiving a termination request sentfrom said PC termination acknowledgement means or said ladder circuitcorrespondence PC termination acknowledgement means in the numericalcontrol system section, wherein the power unit outputs a power resetsignal for inhibiting a controller of the external storage unit in thepersonal computer section from newly writing data when the power isturned off, and has a power supply voltage holding function for holdingpower supply voltage for as long as a time for completion of writing ifan application program starts writing onto the external storage unit atthe same time as the power of the power unit is turned off.
 7. Thenumerical control system as claimed in any one of claims 1 to 4, furthercomprising servo amplifier initialization means provided in thenumerical control system section for transmitting an emergency stopsignal and a termination command to a servo amplifier when power offhandling is started.
 8. The numerical control system as claimed in anyone of claims 1 to 4, further comprising data backup means provided inthe numerical control system section for reading a parameter registeredin the numerical control system section or data edited by a user, andtransferring said parameter or data to the personal computer section aspower off handling is performed, and backup data write means provided inthe personal computer section for writing the backup data from said databackup means into a determined location of a hard disk unit.
 9. Thenumerical control system as claimed in claim 5, further comprising: PCtermination timeout retry check means provided in the numerical controlsystem section for initiating a retry or a timeout check, at least if PCtermination notification from the personal computer section cannot beacknowledged or if an application program start completion notificationcannot be acknowledged, and sending a termination notification to saidPC termination acknowledgement means or said ladder circuitcorrespondence PC termination acknowledgement means: and disk cachecontrol means provided in the personal computer section for invalidatinga disk cache of an external storage unit in the personal computersection after receiving a termination request sent from said PCtermination acknowledgement means or said ladder circuit correspondencePC termination acknowledgement means in the numerical control systemsection, wherein the power unit outputs a power reset signal forinhibiting a controller of the external storage unit in the personalcomputer section from newly writing data when the power is turned off,and has a power supply voltage holding function for holding power supplyvoltage for as long as a time for completion of writing if anapplication program starts writing onto the external storage unit at thesame time as the power of the power unit is turned off.
 10. Thenumerical control system as claimed in claim 5, further comprising servoamplifier initialization means provided in the numerical control systemsection for transmitting an emergency stop signal and a terminationcommand to a servo amplifier when power off handling is started.
 11. Thenumerical control system as claimed in claim 5, further comprising databackup means provided in the numerical control system section forreading a parameter registered in the numerical control system sectionor data edited by a user, and transferring said parameter or data to thepersonal computer section as power off handling is performed, and backupdata write means provided in the personal computer section for writingthe backup data from said data backup means into a determined locationof a hard disk unit.
 12. The numerical control system as claimed inclaim 6, further comprising servo amplifier initialization meansprovided in the numerical control system section for transmitting anemergency stop signal and a termination command to a servo amplifierwhen power off handling is started.
 13. The numerical control system asclaimed in claim 6, further comprising data backup means provided in thenumerical control system section for reading a parameter registered inthe numerical control system section or data edited by a user, andtransferring said parameter or data to the personal computer section aspower off handling is performed, and backup data write means provided inthe personal computer section for writing the backup data from said databackup means into a determined location of a hard disk unit.
 14. Thenumerical control system as claimed in claim 7, further comprising databackup means provided in the numerical control system section forreading a parameter registered in the numerical control system sectionor data edited by a user, and transferring said parameter or data to thepersonal computer section as power off handling is performed, and backupdata write means provided in the personal computer section for writingthe backup data from said data backup means into a determined locationof a hard disk unit.